<template>
  <div id="pdfh5"></div>
</template>
<script>
import Pdfh5 from "pdfh5";
import "pdfh5/css/pdfh5.css";

// 加密
import Base64 from "@/assets/js/base64.js";
export default {
  name: "App",
  data() {
    return {
      pdfh5: null,
      pdfUrl: "",
      // pdfUrlNew: this.$utils.getParams(this, 'pdfUrl'),
      pdfUrlNew:
        "https://aaeasy-file.newbanker.cn/pic/testforyuhan/裴士杰的专属报告_2021-11-02_11_17_21.pdf", //正常是url传参

      numPages: 1, //  pdf 文件总页数
    };
  },
  mounted() {
    let Base64 = require("js-base64").Base64;
    //实例化
    this.pdfh5 = new Pdfh5("#pdfh5", {
      // pdfurl: Base64.decode(this.pdfUrlNew) //pdf的网络地址  ,只有网址加密了才用Base64.decode()
      pdfurl: this.pdfUrlNew, //pdf的网络地址
    });
    //监听完成事件
    this.pdfh5.on("complete", function (status, msg, time) {
      console.log(
        "状态：" +
          status +
          "，信息：" +
          msg +
          "，耗时：" +
          time +
          "毫秒，总页数：" +
          this.totalNum
      );
    });
  },
};
</script>

<style>
* {
  padding: 0;
  margin: 0;
}

#pdfh5 {
  width: 100%;
  height: 85vh;
}
</style>
